(global.webpackJsonp = global.webpackJsonp || []).push([["pages/search/search"], {
  "3ae7": function(t, e, n) {},
  "650b": function(t, e, n) {
      n.r(e);
      var i = n("8fe2"),
      r = n("e143");
      for (var o in r)"default" !== o &&
      function(t) {
          n.d(e, t,
          function() {
              return r[t]
          })
      } (o);
      n("9561");
      var s = n("2877"),
      a = Object(s.a)(r.
  default, i.a, i.b, !1, null, "8b8a8262", null);
      e.
  default = a.exports
  },
  "8fe2": function(t, e, n) {
      var i = function() {
          var t = this;
          t.$createElement;
          t._self._c
      },
      r = [];
      n.d(e, "a",
      function() {
          return i
      }),
      n.d(e, "b",
      function() {
          return r
      })
  },
  9561 : function(t, e, n) {
      var i = n("3ae7");
      n.n(i).a
  },
  e143: function(t, e, n) {
      n.r(e);
      var i = n("face"),
      r = n.n(i);
      for (var o in i)"default" !== o &&
      function(t) {
          n.d(e, t,
          function() {
              return i[t]
          })
      } (o);
      e.
  default = r.a
  },
  face: function(t, e, n) { (function(t) {
          function i(t) {
              return s(t) || o(t) || r()
          }
          function r() {
              throw new TypeError("Invalid attempt to spread non-iterable instance")
          }
          function o(t) {
              if (Symbol.iterator in Object(t) || "[object Arguments]" === Object.prototype.toString.call(t)) return Array.from(t)
          }
          function s(t) {
              if (Array.isArray(t)) {
                  for (var e = 0,
                  n = new Array(t.length); e < t.length; e++) n[e] = t[e];
                  return n
              }
          }
          function a(t, e) {
              var n = Object.keys(t);
              if (Object.getOwnPropertySymbols) {
                  var i = Object.getOwnPropertySymbols(t);
                  e && (i = i.filter(function(e) {
                      return Object.getOwnPropertyDescriptor(t, e).enumerable
                  })),
                  n.push.apply(n, i)
              }
              return n
          }
          function c(t, e, n) {
              return e in t ? Object.defineProperty(t, e, {
                  value: n,
                  enumerable: !0,
                  configurable: !0,
                  writable: !0
              }) : t[e] = n,
              t
          }
          Object.defineProperty(e, "__esModule", {
              value: !0
          }),
          e.
      default = void 0;
          var h = 1,
          u = !1,
          f = !1,
          l = {
              name: "search",
              props: {
                mch_id:String
              },
              components: {
                  "app-goods-list": function() {
                      return Promise.all([n.e("common/vendor"), n.e("components/page-component/app-goods-list/app-goods-list")]).then(n.bind(null, "3f73"))
                  }
              },
              data: function() {
                  return {
                      searchList: [],
                      searchKey: "",
                      list: [],
                      isSearch: !1,
                      historyList: [],
                      keyword: "",
                      recommend_list: []
                  }
              },
              computed: function(t) {
                  for (var e = 1; e < arguments.length; e++) {
                      var n = null != arguments[e] ? arguments[e] : {};
                      e % 2 ? a(n, !0).forEach(function(e) {
                          c(t, e, n[e])
                      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : a(n).forEach(function(e) {
                          Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
                      })
                  }
                  return t
              } ({},
              (0, n("2f62").mapState)({
                  theme: function(t) {
                      return t.mallConfig.theme
                  }
              }), {
                  newList: function() {
                      return this.list.length > 0 ? this.list: this.recommend_list
                  }
              }),
              onLoad: function() {
                  h = 1,
                  u = !1,
                  f = !1,
                  this.historyList = this.getHistory(),
                  this.getSearchList(),
                  this.getRecommend()
              },
              onReachBottom: function() {
                  f || this.getGoodsList()
              },
              watch: {
                  keyword: {
                      handler: function(t) {
                          "" == t && this.cancel()
                      },
                      immediate: !0
                  }
              },
              methods: {
                  getSearchList: function() {
                      var t = this;
                      this.$showLoading(),
                      this.$request({
                          url: this.$api.
                      default.search_list
                      }).then(function(e) {
                          t.$hideLoading(),
                          t.searchList = e.data
                      })
                  },
                  switchSearch: function(t) {
                      this.searchKey = t,
                      this.historyList = this.getHistory(),
                      this.reset()
                  },
                  cancel: function() {
                      this.isSearch = !1,
                      this.keyword = "",
                      this.list = []
                  },
                  reset: function() {
                      h = 1,
                      this.getGoodsList()
                  },
                  search: function(t) {
                      var e = this.keyword;
                      console.log(e);
                      "" !== e && (this.keyword = e.trim(), this.setHistory(), this.reset())
                  },
                  getGoodsList: function() {
                      var e = this;
                      this.keyword && (u || (u = !0, t.showLoading(), this.$request({
                          url: this.$api.
                      default.goods_list,
                          data: {
                              keyword: this.keyword,
                              sign: this.searchKey,
                              page: h,
                              mch_id: this.mch_id
                          }
                      }).then(function(n) {
                          var r;
                          t.hideLoading(),
                          u = !1,
                          e.isSearch = !0,
                          0 === n.code ? (1 == h && (e.list = []), n.data.list.length > 0 ? ((r = e.list).push.apply(r, i(n.data.list)), h++) : (f = !0, 1 === h && e.getRecommend())) : t.showModal({
                              content: n.msg
                          })
                      }).
                      catch(function() {
                          u = !1,
                          t.hideLoading()
                      })))
                  },
                  setHistory: function() {
                      var e = this.getHistory(),
                      n = this.keyword.trim();
                      e.forEach(function(t, i) {
                          t.keyword === n && e.splice(i, 1)
                      }),
                      e.push({
                          keyword: n
                      }),
                      e.length > 20 && e.shift(),
                      this.historyList = e,
                      t.setStorageSync("SEARCH_HISTORY_LIST", e)
                  },
                  getHistory: function() {
                      var e = t.getStorageSync("SEARCH_HISTORY_LIST");
                      return e || (e = []),
                      e
                  },
                  deleteHistory: function() {
                      t.removeStorageSync("SEARCH_HISTORY_LIST"),
                      this.historyList = []
                  },
                  historyClick: function(t) {
                      this.keyword = t.trim(),
                      this.reset()
                  },
                  getRecommend: function() {
                      var t = this;
                      this.recommend_list.length > 0 || this.$request({
                          url: this.$api.goods.new_recommend,
                          data: {
                              goods_id: 0,
                              type: "goods"
                          }
                      }).then(function(e) {
                          0 === e.code && (t.recommend_list = e.data.list)
                      })
                  }
              }
          };
          e.
      default = l
      }).call(this, n("543d").
  default)
  }
},
[["eef2", "common/runtime", "common/vendor"]]]);